/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import exception.DuplicateConstraintException;
import exception.ExceptionInterceptor;
import exception.RemoveConstraintException;
import java.io.Serializable;
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.inject.Named;
import javax.interceptor.Interceptors;
import model.dao.VinculoDao;
import model.entidades.Vinculo;

/**
 *
 * @author helton
 */
@Named
@Stateless
@Interceptors(ExceptionInterceptor.class)
public class VinculoController implements Serializable{
    @Inject
    VinculoDao vinculoDao;

    public Vinculo insert(Vinculo vinculo) throws DuplicateConstraintException {
        vinculoDao.insert(vinculo);
        return vinculo;
    }

    public Vinculo update(Vinculo vinculo) throws DuplicateConstraintException {
        vinculoDao.update(vinculo);
        return vinculo;
    }

    public void remove(Vinculo vinculo) throws RemoveConstraintException {
        vinculoDao.delete(vinculo);
    }

    public List<Vinculo> getAll(Long profis) {
        return vinculoDao.getAll(profis);
    }    
}
